unit TestGUIU;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, PendulumView, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    PendulumView1: TPendulumView;
    Edit2: TEdit;
    Button2: TButton;
    CheckBox1: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure PendulumView1RequestPause(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure PendulumView1AngleChanged(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure PendulumView1WhatIsThis(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
 PendulumView1.Angle := StrToFloat(Edit1.Text)*pi/180;
 PendulumView1.Paint;
end;

procedure TForm1.PendulumView1RequestPause(Sender: TObject);
var mbReply : integer;
begin

mbReply := Application.MessageBox( 'Do you want to pause the simulation?','Pause Requested', MB_YESNO+MB_ICONQUESTION);
if mbReply = IDYES then
begin
    PendulumView1.IsPaused := true;

end;

CheckBox1.Checked := PendulumView1.IsPaused;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
PendulumView1.IsPaused := CheckBox1.Checked ;
PendulumView1.Paint;
end;

procedure TForm1.PendulumView1AngleChanged(Sender: TObject);
begin
   Application.MessageBox('Angle Changed!', 'Angle Change', MB_OK+MB_ICONINFORMATION);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 PendulumView1.AngularVelocity := StrToFloat(Edit2.Text);
 PendulumView1.Paint;
end;

procedure TForm1.PendulumView1WhatIsThis(Sender: TObject);
begin
    Application.MessageBox('What is this query fired', 'What is this?', MB_OK+MB_ICONINFORMATION);
end;

end.
